from django.db import models


# Create your models here.
class Equipment(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, help_text='资产名称')
    category = models.ForeignKey('equipment_categories.EquipmentCategory',
                                 on_delete=models.CASCADE,
                                 help_text='资产类别')
    address = models.CharField(max_length=100, help_text='资产位置')
    state = models.CharField(max_length=10,
                             choices=(
                                 ('空闲', '空闲'),
                                 ('占用', '占用'),
                                 ('故障', '故障'),
                                 ('报废', '报废'),
                             ),
                             help_text='资产状态')
    department = models.ForeignKey('departments.Department',
                                   on_delete=models.CASCADE,
                                   help_text='资产所属部门')

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = '资产'
        verbose_name_plural = '资产清单'
